<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{$title}</title>
<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<div class="main">
	<img src="__PUBLIC__/images/kg.jpg" style="margin-left:140px; margin-bottom:15px; display:block;"/>
	<p class="ss"><a href="#">疾病百科</a><a href="#">咨询智库</a><a href="#">竞价智库</a><a href="#">策划智库</a></p>
    <form method="post" action="__MODULE__/Indexsearch/index">
    	<input name="search" type="text" class="search fl"  placeholder="请输入你想要搜索的信息">
        <input type="submit" name="submit" value="智搜一下" class="submit">
    </form>
    <h3>登录</h3>
    <p style="text-align:center;">注：登录后，可参与编辑康冠智库的内容</p>
    <p style="text-align:center; width:340px; margin:15px auto; overflow:hidden; display:none;" class="ct"><a href="__MODULE__/Search/index" class="fl">查看我的词条</a><a href="__MODULE__/Admin/index" class="fr" >进入后台</a></p>
</div>
<div class="login">
    <div class="login1">
    	<span>X</span>
        <p></p>
    	<input name="name" type="text" placeholder="用户名" maxlength="5" class="sr"/>
        <input name="password" type="password" placeholder="密码" maxlength="10" class="sr"/><br/>
        <input type="checkbox" class="remenber"/>记住密码 <br/>
        <input type="button" value="登录" class="dl"/>
    </div>
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery/jquery.cookie.js"></script>
<script>
$(function(){
	if($.cookie('name')){
		$(".main h3").css("color","#0089e1").html($.cookie('name'));	
		$(".login").slideUp(500);	
		$(".main p.ct").fadeIn(500);
	}
	$(".main h3").click(function(){
		var name=$(this).html();
		if(name=="登录"){
			$(".login").show(500);	
		}
	});
	$(".login .login1 span").click(function(){
		$(".login").slideUp(500);	
	});	
	if($.cookie('name')&&$.cookie('password')){
		var a=$.cookie('name');
		var b=$.cookie('password');
		var name=$(".login1 input[name='name']").val(a);
		var password=$(".login1 input[name='password']").val(b);
	}else{
		var name=$(".login1 input[name='name']").val();
		var password=$(".login1 input[name='password']").val();	
	}
	$(".dl").click(function(){
		var name=$(".login1 input[name='name']").val();
		var password=$(".login1 input[name='password']").val();
		if(name!=""&&password!=""){
			$.ajax({
				type:'POST',
				url:"__URL__/login",
				data:{name:name,password:password},
				success: function(data){
					if(data['count']==0){
						$(".login p").html("登录失败！！！");	
					}else{
						setTimeout(function(){
							$(".login p").html("登录成功！！！");
							$(".main h3").css("color","#0089e1").html(name);
							$(".login").slideUp(500);	
							$(".main p.ct").fadeIn(500);
							$.cookie('name',name);
							if($(".login1 input.remenber").attr("checked")==true||$(".login1 input.remenber").attr("checked")=="checked"){
								$.cookie('name',name);
								$.cookie('password',password);		
							}
						},500);	
					}
				},
			});
		}
	});
	$(".ss a").click(function(){
		$(".ss a").removeClass("active");
		$(this).addClass("active");
		var km=$(".ss a.active").html();
		$.cookie('km',km);
	});
})
</script>